# =============================================================================
#	iXe[Waf
# =============================================================================
include	/sys/dir.mak
include	/sys/tmp.mak

VPATH	=	${PAL}:${ZSB}:${BTD}
# -----------------------------------------------------------------------------
#	Ώۃt@C
# -----------------------------------------------------------------------------
BG	=	stkin sttod stbig stkar stjoh stlee stjac stmic

BGDS	=	${addsuffix .bgd,${BG}}
ZBBS	=	${addsuffix .zbb,${BG}}
PALS	=	${addsuffix .pal,${BG}}
TONS	=	stjac.ton stmic.ton stlee.ton
# -----------------------------------------------------------------------------
#	^[Qbg
# -----------------------------------------------------------------------------
all:	${BGDS} ${ZBBS} ${PALS} ${TONS}

clean:
	${cmdsplit -rm %,60,${addprefix ${BTD}\,${BGDS}}}
	${cmdsplit -rm %,60,${addprefix ${ZSB}\,${ZBBS}}}
	${cmdsplit -rm %,60,${addprefix ${PAL}\,${PALS}}}
# -----------------------------------------------------------------------------
#	K
# -----------------------------------------------------------------------------
stjac.ton:	stjac.cob
	tone -p3,0,0 $^ >$@
# -----------------------------------------------------------------------------
stmic.ton:	stmic.cob
	tone -p2 $^ >$@
# -----------------------------------------------------------------------------
stlee.ton:	stlee.cob
	tone -p13,7,1,1 $^ >$@
# -----------------------------------------------------------------------------
stkin.bgd:	stkin.cyb
	cgbcut -v -s -t0,0 -l0x4c,0x24 $^ ${BTD}\${@F}

sttod.bgd:	sttod.cyb
	cgbcut -v -s -t0,0 -l0x4c,0x24 $^ ${BTD}\${@F}

stbig.bgd:	stbig.cyb
	cgbcut -v -s -t0,0 -l0x4c,0x24 $^ ${BTD}\${@F}

stkar.bgd:	stkar.cyb
	cgbcut -v -s -t0,0 -l0x4c,0x24 $^ ${BTD}\${@F}
	cgbcut -v -s -t0x0e,0x10 -l4,6 $^ ${BTD}\stkar0.bgd
	cgbcut -v -s -t0x00,0x24 -l4,6 $^ ${BTD}\stkar1.bgd
	cgbcut -v -s -t0x08,0x24 -l4,6 $^ ${BTD}\stkar2.bgd

stjoh.bgd:	stjoh.cyb
	cgbcut -v -s -t0,0 -l0x4c,0x24 $^ ${BTD}\${@F}
	cgbcut -h -s -t0x15,0x08 -l35,1 $^ ${BTD}\rotor0.bgd
	cgbcut -h -s -t0x10,0x28 -l35,1 $^ ${BTD}\rotor1.bgd
	cgbcut -h -s -t0x10,0x29 -l35,1 $^ ${BTD}\rotor2.bgd
	cgbcut -h -s -t0x10,0x2a -l35,1 $^ ${BTD}\rotor3.bgd
	cgbcut -h -s -t0x10,0x2b -l35,1 $^ ${BTD}\rotor4.bgd
	cgbcut -h -s -t0x10,0x2c -l35,1 $^ ${BTD}\rotor5.bgd
	cgbcut -h -s -t0x10,0x2d -l35,1 $^ ${BTD}\rotor6.bgd
	cgbcut -h -s -t0x10,0x2e -l35,1 $^ ${BTD}\rotor7.bgd
	cgbcut -v -s -t0x14,0x12 -l7,12 $^ ${BTD}\man00.bgd
	cgbcut -v -s -t0x00,0x28 -l7,12 $^ ${BTD}\man01.bgd
	cgbcut -v -s -t0x2e,0x12 -l9,12 $^ ${BTD}\man10.bgd
	cgbcut -v -s -t0x07,0x28 -l9,12 $^ ${BTD}\man11.bgd

stlee.bgd:	stlee.cyb
	cgbcut -v -s -t0,0 -l0x4c,0x24 $^ ${BTD}\${@F}

stjac.bgd:	stjac.cyb
	cgbcut -v -s -t0,0 -l0x4c,0x24 $^ ${BTD}\${@F}

stmic.bgd:	stmic.cyb
	cgbcut -v -s -t0,0 -l0x4c,0x24 $^ ${BTD}\${@F}
	cgbcut -v -s -t0x0c,0x0d -l5,8 $^ ${BTD}\stmic0.bgd
	cgbcut -v -s -t0x00,0x28 -l5,8 $^ ${BTD}\stmic1.bgd
	cgbcut -v -s -t0x05,0x28 -l5,8 $^ ${BTD}\stmic2.bgd
# ---------------------------------------------------------------------------
#	comprezz ͂PoNkłȂ
# ---------------------------------------------------------------------------
stkin.zbb:	stkin0.cbb stkin1.cbb
	comprezz stkin0.cbb $0
	comprezz stkin1.cbb $1
	copy /b $0+$1 ${ZSB}\${@F}

sttod.zbb:	sttod0.cbb sttod1.cbb
	comprezz sttod0.cbb $0
	comprezz sttod1.cbb $1
	copy /b $0+$1 ${ZSB}\${@F}

stbig.zbb:	stbig0.cbb stbig1.cbb
	comprezz stbig0.cbb $0
	comprezz stbig1.cbb $1
	copy /b $0+$1 ${ZSB}\${@F}

stkar.zbb:	stkar0.cbb stkar1.cbb
	comprezz stkar0.cbb $0
	comprezz stkar1.cbb $1
	copy /b $0+$1 ${ZSB}\${@F}

stjoh.zbb:	stjoh0.cbb stjoh1.cbb
	comprezz stjoh0.cbb $0
	comprezz stjoh1.cbb $1
	copy /b $0+$1 ${ZSB}\${@F}

stlee.zbb:	stlee0.cbb stlee1.cbb
	comprezz stlee0.cbb $0
	comprezz stlee1.cbb $1
	copy /b $0+$1 ${ZSB}\${@F}

stjac.zbb:	stjac0.cbb stjac1.cbb
	comprezz stjac0.cbb $0
	comprezz stjac1.cbb $1
	copy /b $0+$1 ${ZSB}\${@F}

stmic.zbb:	stmic0.cbb stmic1.cbb
	comprezz stmic0.cbb $0
	comprezz stmic1.cbb $1
	copy /b $0+$1 ${ZSB}\${@F}
# ----------------------------------------------------------------------------
stkin.pal:	stkin0.ccb
	pakccb -s -u14 $^ ${PAL}\${@F}

sttod.pal:	sttod0.ccb
	pakccb -s -u14 $^ ${PAL}\${@F}

stbig.pal:	stbig0.ccb
	pakccb -s -u14 $^ ${PAL}\${@F}

stkar.pal:	stkar0.ccb
	pakccb -s -u14 $^ ${PAL}\${@F}

stjoh.pal:	stjoh0.ccb
	pakccb -s -u14 $^ ${PAL}\${@F}

stlee.pal:	stlee0.ccb
	pakccb -s -u14 $^ ${PAL}\${@F}

stjac.pal:	stjac0.ccb
	pakccb -s -u14 $^ ${PAL}\${@F}

stmic.pal:	stmic0.ccb
	pakccb -s -u14 $^ ${PAL}\${@F}
